<?php
namespace Home\Controller;
use Common\Controller\CommonController;
class IndexController extends CommonController {
 	public function _initialize(){
		
 		parent::_initialize();
 	}
 	public function index(){
 		$this->display();
 	}
	//绌烘搷浣�
	/* public function _empty(){
		
		header("HTTP/1.0 404 Not Found");
		$this->display('Public:404');
	} */
	public function checkOpenId(){
		//session_destroy();
		//$_SESSION['openid']='111';
		$where['openid']=$_SESSION['openid'];
		$member=M('Member')->where($where)->find();
		//$get_user_info_url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=".S('assess_token')."&openid=".$_SESSION['openid']."&lang=zh_CN";
		//$user_info =$this->curl_get($get_user_info_url);
		if(!$member){
			$data['status']=0;
			$data['info']="";
			//$data['session']=$_SESSION;
			$this->ajaxReturn($data,'JSONP');
		}else{
			$data['status']=1;
			$data['info']=$member;
			$_SESSION['member_id']=$member['member_id'];
			//$data['session']=$_SESSION;
			$this->ajaxReturn($data,'JSONP');
		}
	}
	//使用curl的GET请求数据  返回数组
	protected function curl_get($http){
		//初始化
		$ch = curl_init();
		//设置选项，包括URL
		curl_setopt($ch, CURLOPT_URL, $http);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		curl_setopt($ch, CURLOPT_HEADER, 0);
		//执行并获取HTML文档内容
		$output = curl_exec($ch);
		//释放curl句柄
		curl_close($ch);
		//打印获得的数据
		$result = json_decode($output,true);
		return $result;
	}
}